#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int removeElement(int* nums, int numsSize, int val) {
    int len = numsSize;
    for (int i = 0; i < numsSize; i++)
    {
        if (((nums[i] ^ val) == 0))
        {
            nums[i] = nums[numsSize - 1];
            numsSize--;
            i--;
            len = len - 1;
        }
    }
    return len;
}
int main()
{
    int arr[] = { 0,1,2,2,3,0,4,2 };
    int len = removeElement(arr, 8, 2);
    for (int i = 0; i < len; i++)
    {
        printf("%d ",arr[i]);
    }
}